package com.zrrd.charStream.writer;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author WanJl
 * @version 1.0
 * @title WriterDemo01
 * @description 文件字符输出流
 * @create 2024/5/26
 */
public class FileWriterDemo01 {
    public static void main(String[] args) {
        //创建FileWriter对象
        FileWriter fw = null;
        try {
            fw=new FileWriter("E:/users/abc.txt");

            //调用输出的方法
            fw.write(97);
            fw.write(new char[] { 'a', 'b', 'c', 'd', 'e', 'f' });
            fw.flush();

            fw.write("今天天气不错~是风和日丽的~");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            try {
                fw.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
